package com.ln.design.mode.proxy.dynamic;

import com.ln.design.mode.proxy.SmsService;
import com.ln.design.mode.proxy.SmsServiceImpl;

import java.lang.reflect.Proxy;

/**
 * @Description SmsDynamicProxyTest
 * @Author zhangj
 * @Date 2022/11/29 23:00
 */
public class SmsDynamicProxyTest {

    public static void main(String[] args) {

        SmsService smsService = (SmsService) Proxy.newProxyInstance(
                SmsServiceImpl.class.getClassLoader(),
                SmsServiceImpl.class.getInterfaces(),
                new SmsDynamicProxy(new SmsServiceImpl())
        );

        smsService.send("hello");
    }

}
